package cn.edu.ctbu.aop.service;

import cn.edu.ctbu.aop.domain.Student;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;

public interface StudentServiceIn {
    public List<Student> getAll();
    public Page<Student> getAll(Pageable pageable);
    public List<Student> getAll(Example<Student> example);

    /**
     * 通过姓名来查询对应的学生列表
     * @param studentName 指定姓名的学生列表
     * @return
     */
    public List<Student> findByName(String studentName);
    public List<Student> findByNameLike(String studentName);
    public Student findById(Integer id);
    public List<Student> getStudentScoreLess(Integer score);
    public List<Student> searchByName(String name);
    public List<Student> findByCourse(Integer cno);
    public Student findByNo(String no);
    public void deleteById(Integer id);
    /**
     * 新增和更新单个学生
     * @param student 学生对象
     * @return
     */
    public Student save(Student student);
    public void delete(Integer id);
    public void delete(Student student);

    /**
     * 支持分页的找出所有学生
     * @param pageable 分页
     * @return
     */
    public Page<Student> findAll(Pageable pageable);

    /**
     * 按性别查询，并分页
     * @param sex 学生性别
     * @param pageable
     * @return
     */
    public Page<Student> findBySex(Integer sex, Pageable pageable);
    public Boolean existsByNo(String no);
    public Boolean validUserNameAndPassword(String studentName, String password) throws Exception;
}
